<?php
require('./configs/config.php');
session_start();
include 'header.php';
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
	extract($_POST);
	$isOK = $db->insert('s_goods', array('goodsName' => $goodsName,'categoryId' =>$categoryId , 'goodsPrice' => $goodsPrice ,'remark' => $remark,'addby' => $_SESSION['user'],'addtime' => 'now'))?:0;
	$smarty->assign('isOK',$isOK);
}
$categories = $db->get_all("select * from `s_category`");
$goods = $db->get_all("select * from `s_goods`");

$smarty->assign('goods',$goods);
$smarty->assign('categories',$categories);
$smarty->display('add-goods.tpl');